import mySql from "../../sql/index"
export default {
	route: '/web/updateRecentWork',
	async handle(params){
		let res:any =  await mySql.queryByKey({
			tableName: 'recentWork',
      target: params.id
		});
    if(res.result){   
      params = {...res.result,...params};
      params.weightNum = res.result.weightNum+1;
      return mySql.update({
        tableName: 'recentWork',
        data: params
      })
    }else{
      params.weightNum = 1;
      return mySql.insert({
        tableName: 'recentWork',
        data: params
      })
    }
	}
}